home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
wnx1091.lzh
/
XES_DEV1.DOC
< prev
next >
Wrap
Text File
|
1991-10-20
|
35KB
|
785 lines
XES: eXtended Environment System
=================================
Official Documentation for XES Programmers
October 20,1991
by
Charles H. Medley, Jr.
ENiGMA Software
659 Kennedy Street, N.E.
Washington, D.C. 20011
(202) 636-9078
Simple Overview
+-+-+-+-+-+-+-+
The XES consists of two parts:
o The TRAP #5 Dispatcher.
o The User Mode Handler.
Every XES function is accessed by passing parameter(s) on the
stack, and then doing a TRAP #5. To allow for full independence
between copies of Wind-X, and their utilities, the TRAP #5 simply
"fixes" up the parameters and passes them to a subroutine I call
the User Mode Handler.
The purpose of the User Mode Handler is to replace large,
memory hogging subroutines that would be required for almost every
WNX application with a simple call.
This allows the XES to serve as a way to do complicated AES
functions, and replace large subroutines that would normally be
needed within an application with one call. A good example of
this is XES_REDRAW (43) which can handle window redraws for an
XES-based application, with just a few lines of code. I will go
into detail on how each call works later on in this document.
The method used by the XES is this:
o Wind-XES does a JSR into the WNX application to
begin to run it.
o When the WNX does a call to the XES (via TRAP #5)
it's execution is stopped, and the system is put in
supervisor mode. The data and address registers
are saved (A1-A6 and D3-D7 are saved).
o The Trap Handler adjusts the value on the stack
where the RTE is to occur (from the TRAP #5) and
saves the RTE address for use by the User Mode
Handler, and then does an RTE back to the parent
copy of Wind-X's User Mode Handler after setting.
o The User Mode Handler performs the function
requested and JSRs back into the WNX's code at the
location that the TRAP #5 would have RTE'd back to.
This means that you should NOT try to fix the
stack up, like you do after a normal call to
GEMDOS, because the User Mode Handler has already
dealt with that. The original A1-A6/D3-D7 values
are restored (as of 9/09/90 version incarnation of
the XES).
o This occurs over and over until either the WNX
process hits an RTS that doesn't have a
corresponding BSR/JSR within it's code, or until it
reaches a XES_SUBMIT call.
One thing to note is that all data and address registers
should be assumed to be unknown values when a WNX is first JSRed
to. This may change by the time Wind-XES makes it to market, but
for the most part, this isn't needed. Also, note that the SR is
not properly restored after the TRAP #5 call, so don't count on
the CCR remaining unchanged after a TRAP #5 as you can with other
TRAPs.
How To Write For the XES
+-+-+-+-+-+-+-+-+-+-+-+-
A WNX application has to do two things first:
1) It must call XES_INIT with the address of a
parameter block of the form:
Name Size Purpose
---- ---- -------
WNX_id (word) one word I.D. number,
assigned by the XES.
WNX_idname (16 bytes) unique 16 byte identifier
set by WNX.
WNX_apid (word) application I.D. of parent
copy of Wind-X
WNX_grafhandle (word) graphics handle of parent
WNX_global (long) ptr to parent's GLOBAL
array
WNX_vdiparams (long) ptr to parent's VDI
array
WNX_aesparams (long) ptr to parent's AES array
WNX_messagebuf (long) ptr to parent's message
buffer
WNX_in (8 words) WNX_in array
WNX_out (8 words) WNX_out array
WNX_flags (word) event flags (a la the AES
call evnt_multi)
WNX_link (long) address for resuming
execution (used by XES)
WNX_tcount (word) timer count in 20ms
between events.
WNX_troutine (long) address of TIMER routine
WNX_mroutine (long) address of MESSAGE routine
WNX_broutine (long) address of BUTTON routine
WNX_kroutine (long) address of KEYBOARD
routine
WNX_rroutine (long) address of REDRAW routine
WNX_termroutine (long) address if WNX terminates
(this runs after a
WNX_flush call!)
The values for WNX_id, WNX_apid, WNX_grafhandle,
WNX_global, WNX_vdiparams, WNX_aesparams,
WNX_messagebuf, and WNX_link are set by the XES
immediately after this call.
2) Now, the WNX must do a XES_RSRCINIT with a pointer
to a binary resource that has yet to be fixed up to
the proper screen coordinates. Because the GEM AES
is not friendly to programmers who design resources
in color, various options are allowed with a one
word flag which permits you to determine if the
resource is scaled in any way relative to the
screen font size (which is how GEM does it), and if
so, how. This first call to XES_RSRCINIT will
initialize the resource that will be displayed in
the main Wind-XES window.
Note: You may also use a resource that has been
previously fixed, but the provision for this is
not fully implemented as of 8/23/91. Also, Laser
C's RCP.PRG can generate a .C file that is, in
essence, a .RSC file that you can "imbed" in your C
applications. It will need a "fixup", so simply
pass a pointer to the array it defines, and Wind-
XES will work everything out...
3) At this point, the WNX application can do anything
it wishes (i.e. initialize system variables, find
out information about the screen, etc...) and even
call the XES until it does a XES_SUBMIT. It is
good practice to do the XES_SUBMIT and NOT an RTS
on this part of the code. The WNX application is
required to supply pointers to subroutines that
should be executed by Wind-XES when events that
it is looking for occur BEFORE the XES_SUBMIT is
done. By making the processing the GEM events
modular this helps improve execution speed, and
makes life easier on WNX programmers, particularly